#!/bin/bash
if [ ! -d "/home/nuc/slam_data" ];then
  mkdir /home/nuc/slam_data
fi
nginxurl=/opt/openresty/nginx
. $nginxurl/scripts/golo.conf
source  $ROS_ASLAM_WS_PATH
roscd perception_ros/../../../map
mapdir=$(pwd)
if [ ! -n "$1" ];then
        echo "000";exit 0
fi
sudo rm -rf   $mapdir/network_data  
sleep 1
sudo cp -rf $mapdir/$1 $mapdir/network_data
sudo chmod 777 $mapdir/network_data -R
while true
do
oldoriginsize=`ls -l $mapdir/$1/map_picture.png | awk '{ print $5 }'`
neworiginsize=`ls -l $mapdir/network_data/map_picture.png | awk '{ print $5 }'`
if [ $neworiginsize -eq $oldoriginsize ];then
        break;sudo chmod 777 $mapdir -R
fi
 sleep 1
done
if [ ! -s  "$mapdir/network_data/map_3d.pcd" ];then
	sudo cp -rf $mapdir/$1 $mapdir/network_data
fi
